/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package swing.dialog;

import java.awt.GridLayout;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

/**
 *
 * @author Administrator
 */
public class AddressDialog extends JDialog
{
  JLabel label1 = new JLabel("Address");
  JLabel label2 = new JLabel("City");
  JLabel label3 = new JLabel("State");
  JLabel label4 = new JLabel("zip code");

  JTextField addressField = new JTextField();
  JTextField cityField = new JTextField();
  JTextField stateField = new JTextField();
  JTextField zipCodeField = new JTextField();

  String[] address = new String[4];

  public AddressDialog(JFrame owner, boolean modal)
  {
    super(owner, modal);
    init();
  }

  public void init()
  {
    this.setTitle("Dialog");
    this.setLayout(new GridLayout(4, 2));
    this.add(label1);
    this.add(addressField);
    this.add(label2);
    this.add(cityField);
    this.add(label3);
    this.add(stateField);
    this.add(label4);
    this.add(zipCodeField);
  }
  public String[] getAddress()
  {
    address[0] = addressField.getText();
    address[1] = cityField.getText();
    address[2] = stateField.getText();
    address[3] = zipCodeField.getText();
    return address;
  }
}
